package com.chagee.store.operation.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author yhl
 * @description: TODO
 * @date 2021/11/2 11:03
 */
@AllArgsConstructor
@Getter
public enum HandleResultEnum {

    INIT(-1, "初始化"),
    FAIL(0, "失败"),
    SUC(1, "成功"),
    ;
    private int code;
    private String desc;

    public static HandleResultEnum of(int code) {
        return Stream.of(HandleResultEnum.values()).filter(var -> code == var.getCode()).findFirst().orElse(null);
    }
}
